#include <iostream>
using namespace std;
class HasPtr{
private:
    shared_ptr<string> name;
    int age;
public:
    HasPtr(share_ptr<string> name = nullptr, int age = 0 ):name(name),age(age){}
    HasPtr(const HasPtr& rhs){
        name = make_shared<string>(rhs.name); //使用智能指针原有的会自动删除
        age = rhs.age;
    }
    HasPtr& operator=(const HasPtr& rhs){
        return HasPtr(rhs);
    }
};

int main()[
    HasPtr hxx{"hxx","22"};
    HasPtr master = hxx;

    shared_ptr<int> pt1;
    shared_ptr<int> pt2;
    
    pt1.swap(pt2);
    
    return 0;
]